{% extends "inner.html" %}
{% block title %}LiveSociety - Amigos{% endblock %}
{% block content %}
	<form name="page" action="">
		<input type="hidden" name="section" value="Amigos">
	</form>
			<div id="body_wrapper">
			<div id="body_content_top" style="min-height: 200px;">
				<b class="msgbox">{{ msgbox|default:"" }}</b>
				<div id="middle_box" style="height:200px">
					<div id="alertbox">{{ msgbox|default:"" }}</div>
					<div class="rb_title">Agregar amigos</div>
					<div class="vt_spacer"></div>
						<form name="addfriend" method="post" onSubmit="add_friend(); return false;">
							{% csrf_token %}
							<input type="text" name="friendmail" value="Ingrese correo..."/>
							<input type="submit" value="Enviar peticion">
						</form>
						<div class="vt_spacer"></div>				
							<div class="rb_comment" style="border: none;">
								<table width="600" style="border: 1px dotted orange;">
									<tr>
										<td align="center" colspan="2">
											<b>Peticiones pendientes</b>
										</td>
									</tr>
								</table>
							</div>	
							{% for request in cu_requests %}
								<form name="acceptform" method="post" onSubmit="accept_request(); return false;">
								{% csrf_token %}	
								<div id="{{request.mail}}" class="rb_comment" style="border: none;">
								<table  width="600" style="border: 1px dotted orange; border-top: none;" >
									<tr>
										<td  align="center"><a href="{{request.id}}"><b style="color: orange;">
												{{ request.name }} {{ request.lastname }}</b> ({{ request.mail }}) desea ser tu amigo
										</a></td>
										<td align="center">
											<input type="hidden" name="m_toaccept" value="{{ request.mail }}"/>
											<input type="submit" value="Aceptar"/>
										</td>
									</tr>
								</table>
								</div>
								</form>
							{% empty %}
								<div class="rb_comment" style="border: none;">
								<table width="600" style="border: 1px dotted orange; border-top: none;" >
									<tr>
										<td align="center">No tienes peticiones pendientes</td>
									</tr>
								</table>
								</div>
							{% endfor %}
					<div class="vt_spacer"></div>
				</div>															
			</div>
			
			
			
			
			<div id="body_content_bottom">
				<div id="bottom_box">
					<div class="rb_title alter_c">
						Lista de amigos
					</div>
							{% for friend in cu_friends %}
								<div class="friend_wrapper">
									<div class="friend_name">
										{{ friend.name }} {{ friend.lastname }}
									</div>
									<canvas class="fav_bg" name="pepito"width="120" height="120">
									</canvas>
									<div class="friend_avatar">
										{% if friend.avatar %}
											<a href="/{{ friend.id }}"><img src="{{ friend.avatar }}" width="100%" height="100%"></a>
										{% else %}
											<a href="/{{ friend.id }}"><img src="/static/img/no_avatar.jpg" width="100%" height="100%"></a>
										{% endif %}
									</div>
									<div class="friend_status">
										{{ friend.bio|default:"Sin Biografia" }}
									</div>
								</div>
							{% empty %}
								<div class="rb_comment">No tienes amigos <img src="http://4.bp.blogspot.com/-i4H-W8-dIO4/TbOWWLoBbzI/AAAAAAAAAIM/AUbIyOUXsFI/s1600/Forever_Alone2.jpg" width="40" height="40"/> </div>
							{% endfor %}
				</div>
			</div>
			</div>
			
			
{% endblock %}
